package com.hspedu.homework;

import java.io.*;

/**
 * @author LiuJinTao
 * @className HomeWork01
 * @date 2024/07/05 23:05
 * @description TODO
 */
public class HomeWork01 {
    public static void main(String[] args) throws IOException {
        String path = "e:\\mytemp";
        File file = new File(path);
        if (!file.exists()) {
            if (file.mkdirs()) {
                System.out.println("创建" + path + "成功");
            } else {
                System.out.println("创建" + path + "失败");
            }
        }

        String path1 = path + "\\hello.txt";
        file = new File(path1);
        if (!file.exists()) {
            if (file.createNewFile()) {
                System.out.println(path1 + "创建成功");
                BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(path1));
                bufferedWriter.write("hello.word~~");
                bufferedWriter.close();
            } else {
                System.out.println(path1 + "失败");
            }
        }

    }
}
